package org.komarichin.beans.service;

import org.komarichin.beans.IRole;
import org.komarichin.beans.IUser;
import org.komarichin.struts2.beans.models.UserRoleModel;

import java.util.Collection;
import java.util.List;

/**
 * User: Michael Komarichin
 * Date: 05.10.2009
 * Time: 11:15:24
 */
public interface IUserService {

    final String SYSTEM_ROLE_NAME = "SYSTEM";
    final String USER_ROLE_NAME = "USER";

    IUser login(String login, String password);

    IRole getRoleById(Long id);

    IUser enroll(String login, String password, String hint);

    List<IUser> getAllowUsers(Long permission);
    List<IRole> getAllowRoles(Long permission);

    IRole createSystemRole();

    IUser createSystemUser();

    IUser findByName(String s);

    void updateUser(IUser user);

    boolean isUserExists(String login);

    List<IUser> getUsers();

    List<IRole> getRoles();

    IRole getUserRole(IUser user);

    Collection<UserRoleModel> getUserRole(Long permission);

    void remove(IUser user);

    void update(IUser user);

    void remove(IRole role);

    void update(IRole role);
}
